#include <asm.h>
#include <regdef.h>
#include <new_inst_test.h>

LEAF(my20_tltiu_ex_test)
    .set noreorder
    addiu s0,s0,1
    li    t0,0x800d0000
    li    s2,9
    sw    s2,0(t0)
##clear cause.TI, status,EXL
    mtc0  zero,c0_compare;
    lui   s7,0x0040
    mtc0  s7,c0_status
    nop
    lui   s7,0x0009
# point 1 ---------------
    TEST_TRAP_HAPPEN(tltiu,4,-1,tltiu_pc_0);
    TEST_TRAP_HAPPEN(tltiu,0,4,tltiu_pc_1);
    TEST_TRAP_HAPPEN(tltiu,0xfefd,0xfffd,tltiu_pc_2);
    TEST_TRAP_HAPPEN(tltiu,0x7f13,0x7f14,tltiu_pc_3);
    TEST_TRAP_HAPPEN(tltiu,0,1,tltiu_pc_4);
# point 2 ------don't happen-----
    TEST_TRAP_NOT_HAPPEN(tltiu,0xffff,0xfffe,tltiu_pc_5);
    TEST_TRAP_NOT_HAPPEN(tltiu,-2,0,tltiu_pc_6);
    TEST_TRAP_NOT_HAPPEN(tltiu,-1,1,tltiu_pc_7);
    TEST_TRAP_NOT_HAPPEN(tltiu,0,0,tltiu_pc_8);
    TEST_TRAP_NOT_HAPPEN(tltiu,0xf323,0x173d,tltiu_pc_9);



###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(my20_tltiu_ex_test)
